package fr.norsys.mapper.console.web;

import java.util.List;

import uk.ltd.getahead.dwr.ExecutionContext;
import fr.norsys.mapper.console.model.Application;
import fr.norsys.mapper.console.model.ConsoleCst;
import fr.norsys.mapper.console.service.LdapTreeBuilder;

public class LdapTreeBuilderDWR {
	private LdapTreeBuilder ldapTreeBuilder;
	
	public LdapTreeBuilder getLdapTreeBuilder() {
		return ldapTreeBuilder;
	}

	public void setLdapTreeBuilder(LdapTreeBuilder ldapTreeBuilder) {
		this.ldapTreeBuilder = ldapTreeBuilder;
	}

	public List getChildren(String root) {
		Application currentAppli = (Application) ExecutionContext.get().getSession().getAttribute(ConsoleCst.CURRENT_APPLICATION);
		ldapTreeBuilder.setConnection(currentAppli.getConnection());
		return ldapTreeBuilder.getChildren(root);
	}
}
